Buffer abstraction.
More...
#include <kanzi/core.ui/graphics3d/gpu_buffer.hpp>
|
| gfx::BufferHandleGuard | getHandle () const |
| | Gets the Kanzi graphics handle of the buffer.
|
| |
| size_t | getSize () const |
| | Gets the size of the buffer.
|
| |
| gfx::BufferUsageFlag | getUsage () const |
| | Gets the buffer usage.
|
| |
| | GPUBuffer ()=default |
| | Default constructor.
|
| |
| | GPUBuffer (GPUBuffer &&other) noexcept |
| | Move constructor.
|
| |
| | GPUBuffer (Renderer &renderer, gfx::BufferUsageFlag usage, ConstByteSpan data, string_view name) |
| | Constructor that initializes with data and uploads immediately.
|
| |
| | GPUBuffer (Renderer &renderer, gfx::BufferUsageFlag usage, size_t size, gfx::BufferHandleGuard handle, string_view name) |
| | Constructor that initializes from existing Kanzi graphics buffer.
|
| |
| | GPUBuffer (Renderer &renderer, gfx::BufferUsageFlag usage, size_t size, string_view name) |
| | Constructor that initializes as empty and without uploading.
|
| |
| GPUBuffer & | operator= (GPUBuffer &&other) noexcept |
| | Move operator.
|
| |
| void | setData (Renderer &renderer, ConstByteSpan data, const bool shrinkToFit) |
| | Updates all data in the buffer.
|
| |
| void | setSubData (Renderer &renderer, ConstByteSpan data, unsigned int offset) |
| | Updates a subsection of data in the buffer.
|
| |
Buffer abstraction.
- Since
- Kanzi 4.0.0
- Removed the m_type field.
- Removed the getType function.
◆ NativeHandle
Backend specific handle type.
For OpenGL that is GLuint (unsigned int).
- Since
- Kanzi 3.9.6
◆ GPUBuffer() [1/5]
| kanzi::GPUBuffer::GPUBuffer |
( |
| ) |
|
|
explicitdefault |
◆ GPUBuffer() [2/5]
Constructor that initializes as empty and without uploading.
- Parameters
-
| renderer | The renderer to use. |
| usage | Buffer usage flags. Usually either vertex or index buffer. |
| size | Initial size in bytes. |
| name | Buffer name. |
- Since
- Kanzi 4.0.0
- Added the
name and usage parameters.
- Removed the
type parameter.
◆ GPUBuffer() [3/5]
Constructor that initializes with data and uploads immediately.
- Parameters
-
| renderer | The renderer to use. |
| usage | Buffer usage flags. Usually either vertex or index buffer. |
| data | Initial data to upload. |
| name | Buffer name. |
- Since
- Kanzi 4.0.0
- Added the
name and usage parameters.
- Removed the
type parameter.
◆ GPUBuffer() [4/5]
Constructor that initializes from existing Kanzi graphics buffer.
- Parameters
-
| renderer | The renderer to use. |
| usage | Buffer usage flags. Usually either vertex or index buffer. |
| size | Initial size in bytes. |
| handle | Kanzi graphics buffer handle. |
| name | Buffer name. |
- Since
- Kanzi 3.9.6
-
Kanzi 4.0.0
- Added the
name and usage parameters.
- Removed the
type parameter.
◆ GPUBuffer() [5/5]
| kanzi::GPUBuffer::GPUBuffer |
( |
GPUBuffer && | other | ) |
|
|
inlinenoexcept |
Move constructor.
- Parameters
-
◆ getHandle()
Gets the Kanzi graphics handle of the buffer.
- Returns
- The Kanzi graphics handle of the buffer.
◆ getSize()
| size_t kanzi::GPUBuffer::getSize |
( |
| ) |
const |
|
inline |
Gets the size of the buffer.
- Returns
- Size of the buffer.
◆ getUsage()
Gets the buffer usage.
- Returns
- Usage of the buffer.
- Since
- Kanzi 4.0.0
◆ setSubData()
Updates a subsection of data in the buffer.
- Parameters
-
| renderer | Pointer to the renderer being used. |
| data | The new data. |
| offset | Offset in the buffer into which to update the data. |
◆ setData()
Updates all data in the buffer.
- Parameters
-
| renderer | Pointer to the renderer being used. |
| data | The new data. |
| shrinkToFit | Whether to allow the buffer to shrink, if the data size is smaller than the buffer size. |
◆ operator=()
Move operator.
- Parameters
-
- Returns
- This object.
◆ resize()
Internal: resize the buffer with data.
- Parameters
-
| size | New size |
| initialData | New data. |
◆ update()
Internal: replace the buffer in VRAM with new data.
- Parameters
-
| renderer | Renderer. |
| offset | Offset to update to. |
| data | New data. |
◆ swap
Swaps buffer contents with each other.
- Parameters
-
| lhs | Left-hand side operand. |
| rhs | Right-hand side operand. |
◆ NativeHandleInvalid
Invalid value to initialize native handles with.
- Since
- Kanzi 3.9.6
◆ m_handle
Internal GL name/handle wrapped with RAII semantics.
◆ m_usage
Buffer usage flags.
- Since
- Kanzi 4.0.0
◆ m_size
Size of the buffer in bytes.
◆ m_name
| string kanzi::GPUBuffer::m_name |
|
protected |
The documentation for this class was generated from the following file: